//
//  SXTThirdLandingView.m
//  SXT
//
//  Created by 赵金鹏 on 16/8/12.
//  Copyright © 2016年 赵金鹏. All rights reserved.
//

#import "SXTThirdLandingView.h"

@interface SXTThirdLandingView()

@property (strong, nonatomic)   UIButton *QQLoginBtn;              /** qq登录按钮 */
@property (strong, nonatomic)   UIButton *sinaLoginBtn;              /** 新浪登陆按钮 */
@property (strong, nonatomic)   UIButton *WXLoginBtn;              /** 微信登录按钮 */
@property (strong, nonatomic)   UILabel *bottomTostLabel;              /** 底部提示一键登录的label */
@property (strong, nonatomic)   UILabel *bottomLineLabel;              /** 底部一键登录分割线 */

@end

@implementation SXTThirdLandingView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.bottomLineLabel];
        [self addSubview:self.bottomTostLabel];
        [self addSubview:self.QQLoginBtn];
        [self addSubview:self.sinaLoginBtn];
        [self addSubview:self.WXLoginBtn];
    }
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    
    
    __weak typeof (self) weakSelf = self;
    [_bottomLineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.mas_top).offset(26);
        make.left.equalTo(weakSelf.mas_left).offset(16);
        make.right.equalTo(weakSelf.mas_right).offset(-16);
        make.height.equalTo(@1);
    }];
    
    [_bottomTostLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(85, 16));
        make.centerX.equalTo(weakSelf.bottomLineLabel.mas_centerX);
        make.centerY.equalTo(weakSelf.bottomLineLabel.mas_centerY);
    }];
    
    [_QQLoginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(45, 45));
        make.top.equalTo(weakSelf.bottomLineLabel.mas_bottom).offset(25);
        make.right.equalTo(weakSelf.WXLoginBtn.mas_left).offset(-(VIEW_WIDTH-135)/4);
    }];
    
    [_sinaLoginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(45, 45));
        make.top.equalTo(weakSelf.bottomLineLabel.mas_bottom).offset(25);
        make.left.equalTo(weakSelf.WXLoginBtn.mas_right).offset((VIEW_WIDTH-135)/4);
    }];
    
    [_WXLoginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(45, 45));
        make.top.equalTo(weakSelf.bottomLineLabel.mas_bottom).offset(25);
        make.centerX.equalTo(weakSelf.mas_centerX);
    }];
}

- (UILabel *)bottomTostLabel{
    if (!_bottomTostLabel) {
        _bottomTostLabel = [[UILabel alloc]init];
        _bottomTostLabel.text = @"一键登录";
        _bottomTostLabel.font = [UIFont systemFontOfSize:16.0];
        _bottomTostLabel.textColor = RGB(190, 190, 190);
        _bottomTostLabel.backgroundColor = MainColor;
        _bottomTostLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _bottomTostLabel;
}

- (UILabel *)bottomLineLabel{
    if (!_bottomLineLabel) {
        _bottomLineLabel = [[UILabel alloc]init];
        _bottomLineLabel.backgroundColor = RGB(223, 223, 223);
    }
    return _bottomLineLabel;
}

- (UIButton *)QQLoginBtn{
    if (!_QQLoginBtn) {
        _QQLoginBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
        [_QQLoginBtn setImage:[UIImage imageNamed:@"登录界面qq登陆"] forState:(UIControlStateNormal)];
        [_QQLoginBtn addTarget:self action:@selector(qqLoginBtnMethod) forControlEvents:(UIControlEventTouchUpInside)];
    }
    return _QQLoginBtn;
}

- (UIButton *)sinaLoginBtn{
    if (!_sinaLoginBtn) {
        _sinaLoginBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
        [_sinaLoginBtn setImage:[UIImage imageNamed:@"登陆界面微博登录"] forState:(UIControlStateNormal)];
        
    }
    return _sinaLoginBtn;
}

- (UIButton *)WXLoginBtn{
    if (!_WXLoginBtn) {
        _WXLoginBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
        [_WXLoginBtn setImage:[UIImage imageNamed:@"登录界面微信登录"] forState:(UIControlStateNormal)];
        
    }
    return _WXLoginBtn;
}

- (void)qqLoginBtnMethod{
    if (_qqBlcok) {
        _qqBlcok();
    }
}

@end
